package 程序;
class Animal {
    public void makeSound() {
        System.out.println("Animal makes a sound");
    }
}
class Dog extends Animal {
    @Override
    public void makeSound() {
        System.out.println("Dog barks");
    }
}
class Cat extends Animal {
    @Override
    public void makeSound() {
        System.out.println("Cat meows");
    }
}
public class 多态 {
    public static void main(String[] args) {
    Animal dog = new Dog();
    Animal cat = new Cat();
    Cat cat2 = new Cat();
    dog.makeSound();
    cat.makeSound();
    cat2.makeSound();
    }
}
